package com.kexinde.wjifen.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 * 
 * @author wei
 * 
 * 兑换记录
 *
 */
@Entity
public class ExchangeLog {
	
	private long id;  // 标识（主键）
	private Date time;  // 兑换时间
	private Gift gift;  // 商品
	private NormalUser normalUser; // 普通用户

	public ExchangeLog(){}

	@Id
	@GeneratedValue
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	@ManyToOne
	public Gift getGift() {
		return gift;
	}

	public void setGift(Gift gift) {
		this.gift = gift;
	}

	@ManyToOne(cascade=CascadeType.ALL)
	public NormalUser getNormalUser() {
		return normalUser;
	}

	public void setNormalUser(NormalUser normalUser) {
		this.normalUser = normalUser;
	}

	@Override
	public String toString() {
		return "ExchangeLog [id=" + id + ", time=" + time + ", gift=" + gift
				+ ", normalUser=" + normalUser + "]";
	}
	
}
